/*
 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PANDA_RUNTIME_INCLUDE_ENTRYPOINTS_GEN_H_
#define PANDA_RUNTIME_INCLUDE_ENTRYPOINTS_GEN_H_

// Autogenerated file -- DO NOT EDIT!

#include "macros.h"
#include <cstdint>

namespace panda {

class Method;
class Class;
class ObjectHeader;

namespace coretypes {
class Array;
class String;
}  // namespace coretypes

using FileEntityId = uint32_t;

}  // namespace panda

% require 'set'
% entrypoints_map = Set.new
% Compiler::entrypoints.each do |entrypoint|
%   next if entrypoint.external?
%   if !entrypoints_map.include? entrypoint.bridge_name
// NOLINTNEXTLINE(readability-named-parameter)
extern "C" <%= entrypoint.signature[0] %> <%= entrypoint.bridge_name %>(<%= entrypoint.signature[1..-1].join(', ') %>);
%     entrypoints_map.add(entrypoint.bridge_name)
%   end
%   if !entrypoints_map.include? entrypoint.entrypoint_name
// NOLINTNEXTLINE(readability-named-parameter)
extern "C" <%= entrypoint.signature[0] %> <%= entrypoint.entrypoint_name %>(<%= entrypoint.signature[1.. - 1].join(', ') %>);
%     entrypoints_map.add(entrypoint.entrypoint_name)
%   end
% end

namespace panda {

static constexpr uint32_t ENTRYPOINTS_CRC32 = <%= Compiler::entrypoints_crc32 %>;

enum class EntrypointId : uint8_t {
% Compiler::entrypoints.each_with_index do |entrypoint, index|
    <%= entrypoint.enum_name %> = <%= index %>,
% end
    COUNT
};

struct EntrypointsTable {
% Compiler::entrypoints.each do |entrypoint|
%   initialize_value = entrypoint.external? ? 'nullptr' : entrypoint.bridge_name
    // <%= entrypoint.enum_name %>
    <%= entrypoint.signature[0] %> (*p<%= entrypoint.name %>)(<%= entrypoint.signature[1..-1].join(', ') %>){<%= initialize_value %>};
% end
};

}  // namespace panda

#endif  // PANDA_RUNTIME_INCLUDE_ENTRYPOINTS_GEN_H_
